<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/common.jspf"%>
<%@ include file="/common/taglibs.jspf"%>
<html lang="en">
	<head>
      <!-- portal -->
      <link href="${contextPath}/static/widgets/portal/css/inettuts.css" rel="stylesheet" type="text/css" />
      <link href="${contextPath}/static/widgets/portal/css/inettuts.ext.css" rel="stylesheet" type="text/css" />
      <script type="text/javascript" src="${contextPath}/static/widgets/jquery-ui/js/jquery-ui-1.10.0.custom.min.js"></script>
      <script type="text/javascript" src="${contextPath}/static/widgets/portal/js/inettuts.js"></script>
      <style type="text/css">
        .list-table a {color: black;}
        .more-div {text-align: center;padding: 5px;margin: 3px 0;cursor: pointer;}
        .more-div span {font-size: 12px;}
        .more-div:hover {background-color: #f5f5f5;}        
      </style>
      <script type="text/javascript">
      var __CONTEXT_PATH = "${contextPath}";      
      </script>
	</head>
	<body>	
      <div class="row-fluid">  
        <div class="pull-right">
          <a href="${contextPath }/assistant/userPortlet/index.do"><i class="icon-briefcase"></i> 个性定制</a>
        </div>
        <div class="clear"></div>     
        <div id="columns">
            <ul id="column1" class="column">
              <c:forEach items="${userPortlets }" var="row">
                ${row }
              </c:forEach>
              
              
                <li class="widget color-blue"  style="display: none;">
                  <div class="widget-head">
                      <h3>我的任务</h3>
                  </div>
                  <div id="myTaskWidget" class="widget-content">
                    <div style="border-bottom: 1px solid #ABABAB;padding:4px">过滤条件：<input placeholder="项目名称"></div> 
                    <table class="table table-striped table-hover table-condensed" style="width: 100%">
                      <thead>
                        <tr>
                          <th width="35px">序号</th>
                          <th width="200px">任务名称</th>
                          <th width="100px">所属项目</th>
                        </tr>
                      </thead>  
                      <tbody>  
                        <tr>
                          <td>1</td>
                          <td>完成销售、备料、生产、发货完整流程</td>
                          <td>赛蒙</td>
                        </tr>
                        <tr>
                          <td>2</td>
                          <td>开发请购单和采购模块</td>
                          <td>赛蒙</td>
                        </tr>
                      </tbody>
                    </table>
                    <div class="more-div" onclick="showDocMore(1);" type="1">
                      <span>更多</span> <i class="icon-chevron-down icon-large"></i>
                    </div>
                  </div>
                </li>  
                
                                         
                <li class="widget color-blue">  
                    <div class="widget-head">
                        <h3>我收藏的文档</h3>
                    </div>
                    <div class="widget-content">
                     <h:userFavourite moduleCode="shareFile"></h:userFavourite>                      
                    </div>
                </li>
                <li class="widget color-blue">  
                    <div class="widget-head">
                        <h3>最新上传文档</h3>
                    </div>
                    <div class="widget-content">
                      <h:shareFileNewest moduleCode="tenant"></h:shareFileNewest>   
                    </div>
                </li>
            </ul>
    
            <ul id="column2" class="column">                            
                <li class="widget color-blue">  
                    <div class="widget-head">
                        <h3>近30日上传文档统计</h3>                                          
                    </div>
                    <div class="widget-content">
                      <div id="doc-statUploadByDays-chart" style="height:200px;"></div>
                      <script type="text/javascript" src="${contextPath }/static/modules/doc-statUploadByDays-chart.js"></script>  
                    </div>
                </li>
                <li class="widget color-blue">  
                    <div class="widget-head">
                        <h3>近30日上传文档分类统计</h3>
                    </div>
                    <div class="widget-content">
                      <div id="doc-statUploadByFileExt-chart" style="height:200px;"></div>
                      <script type="text/javascript" src="${contextPath }/static/modules/doc-statUploadByFileExt-chart.js"></script>  
                    </div>
                </li>
                <li class="widget color-blue">  
                    <div class="widget-head">
                        <h3>总文档分类统计</h3>
                    </div>
                    <div class="widget-content">
                      <div id="doc-statAllByFileExt-chart" style="height:200px;"></div>
                      <script type="text/javascript" src="${contextPath }/static/modules/doc-statAllByFileExt-chart.js"></script>  
                    </div>
                </li>   
            </ul>
            
            <ul id="column3" class="column">
                <li class="widget color-blue">  
                    <div class="widget-head">
                        <h3><s:message code="affiche"></s:message></h3>
                    </div>
                    <div id="affichePanel" class="widget-content" ng-controller="AfficheCtrl">
                          <table class="table table-striped table-hover table-condensed" style="width: 100%">
                              <tbody>
                                <tr ng-repeat="affiche in afficheList">
                                  <td>
                                    <span class="label label-info">{{affiche.typeDescr }}</span>&nbsp;&nbsp;<a href="${contextPath }/message/affiche/show.do?id={{affiche.id}}" target="_blank">{{affiche.title}}</a>
                                  </td>
                                  <td><small class="muted pull-right">[{{affiche.updateDatetime | date : 'yyyy-MM-dd' }}]</small></td>
                                </tr>
                              </tbody>
                          </table> 
                          <div class="more-div" ng-click="showMoreAffiche()"><span>更多</span> <i class="icon-chevron-down icon-large"></i></div>
                        </div>
                </li>
            </ul>
        </div>
      </div>
  
      <!-- angularjs -->
      <script type="text/javascript" src="${contextPath }/theme/default/js/angular.js"></script>        
      <!-- echarts -->
      <script src="${contextPath }/static/widgets/echarts/echarts-all.js"></script>
      <!-- inline scripts related to this page -->
      <script type="text/javascript">
      $(document).ready(function(){    
        iNettuts.init();
        
        initAngularjs();
        
      });
      
      function AfficheCtrl($scope, $http, $filter) {
        $scope.afficheList = [];
        var pageIndex = 2;
        
        $http.post("${contextPath}/message/affiche/getTopN.json").success(function(data) {
          var afficheList = data.afficheList;
          for(i=0;i<afficheList.length;i++)
          {
            var affiche = afficheList[i];
            if(1==affiche.type)
            {
              affiche.typeDescr = "<s:message code='dictparam.affiche-type.1' />"; 
            }
            else if(2==affiche.type)
            {
              affiche.typeDescr = "<s:message code='dictparam.affiche-type.2' />"; 
            }
            else if(3==affiche.type)
            {
              affiche.typeDescr = "<s:message code='dictparam.affiche-type.3' />"; 
            }
          }
          $scope.afficheList = afficheList;
        });
        
        $scope.showMoreAffiche = function(){
          $http.post("${contextPath}/message/affiche/getTopN.json", {"pageIndex": pageIndex}).success(function(data) {
            var afficheList = data.afficheList;
            if(0==afficheList.length)
            {
              $.webtools.notify({
                type: "notice",
                position: "center",
                delay: 1500,
                message: "<s:message code='btn.more.nomore' />"			
              }); 
              return;
            }
            for(i=0;i<afficheList.length;i++)
            {
              var affiche = afficheList[i];
              if(1==affiche.type)
              {
                affiche.typeDescr = "<s:message code='dictparam.affiche-type.1' />"; 
              }
              else if(2==affiche.type)
              {
                affiche.typeDescr = "<s:message code='dictparam.affiche-type.2' />"; 
              }
              else if(3==affiche.type)
              {
                affiche.typeDescr = "<s:message code='dictparam.affiche-type.3' />"; 
              }
              $scope.afficheList.push(affiche);
            }
            pageIndex++;
          });
        }        
      }
      
      
      
      
      </script>
	</body>
</html>
